import time
now = time.time()
tm = time.localtime(now)
print(now)
print(tm)

#时间转字符串
s = time.strftime("%Y-%m-%d",tm)
print(s)

s = time.strftime("%Y-%m-%d %H:%M:%S",tm)
print(s)

#字符串转换成元组
tm2 = time.strptime(s,"%Y-%m-%d %H:%M:%S")
print(tm2)

#时间元组和时间戳之间的转换
#1.时间戳转时间元组
tm1 = time.localtime(now)  #本地时间
tm2 = time.gmtime(now)   #UTC的时间
print(tm1)
print(tm2)

#2.时间元组转时间戳
print(time.mktime(tm1))

#时间的英文字符串
#1.时间元组转英文字符串
print(time.asctime(time.localtime()))

#2.时间戳转换英文字符串
print(time.ctime(time.time()))
print(time.asctime(time.localtime(time.time())))